home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / ataxx.c < prev    next >
C/C++ Source or Header  |  2000-05-23  |  38KB  |  1,343 lines

  1. /***************************************************************************
  2.  
  3.     Leland Ataxx-era driver
  4.  
  5.     driver by Aaron Giles and Paul Leaman
  6.  
  7.     -------------------------------------
  8.  
  9.     To enter service mode in Ataxx, press 1P start and then press
  10.     the service switch (F2).
  11.  
  12.     For World Soccer Finals, press the 1P button B and then press the
  13.     service switch.
  14.  
  15.     For Indy Heat, press the red turbo button (1P button 1) and then
  16.     press the service switch.
  17.  
  18.     -------------------------------------
  19.  
  20.     Still to do:
  21.         - memory map
  22.         - generate fake serial numbers
  23.  
  24. ***************************************************************************/
  25.  
  26.  
  27. #include "driver.h"
  28.  
  29. #include "vidhrdw/generic.h"
  30. #include "machine/eeprom.h"
  31.  
  32. #include "cpu/z80/z80.h"
  33.  
  34.  
  35. /* define these to 0 to disable, or to 1 to enable */
  36. #define LOG_BANKSWITCHING_M    0
  37. #define LOG_BANKSWITCHING_S    0
  38. #define LOG_EEPROM            0
  39. #define LOG_XROM            0
  40. #define LOG_BATTERY_RAM        0
  41.  
  42.  
  43. /* Helps document the input ports. */
  44. #define IPT_SLAVEHALT     IPT_SPECIAL
  45. #define IPT_EEPROM_DATA    IPT_SPECIAL
  46. #define PORT_SERVICE_NO_TOGGLE(mask,default)    \
  47.     PORT_BITX(    mask, mask & default, IPT_DIPSWITCH_NAME, DEF_STR( Service_Mode ), KEYCODE_F2, IP_JOY_NONE )    \
  48.     PORT_DIPSETTING(    mask & default, DEF_STR( Off ) )    \
  49.     PORT_DIPSETTING(    mask &~default, DEF_STR( On ) )
  50.  
  51.  
  52. static UINT8 wcol_enable;
  53.  
  54. static void *master_int_timer;
  55.  
  56. static UINT8 *master_base;
  57. static UINT8 *slave_base;
  58. static UINT8 *xrom_base;
  59. static UINT32 master_length;
  60. static UINT32 slave_length;
  61. static UINT32 xrom_length;
  62.  
  63. static UINT8 analog_result;
  64. static UINT8 dial_last_input[4];
  65. static UINT8 dial_last_result[4];
  66.  
  67. static UINT8 master_bank;
  68.  
  69. static UINT32 xrom1_addr;
  70. static UINT32 xrom2_addr;
  71.  
  72. #define battery_ram_size 0x4000
  73. static UINT8 battery_ram_enable;
  74. static UINT8 *battery_ram;
  75.  
  76. #define extra_tram_size 0x800
  77. static UINT8 *extra_tram;
  78.  
  79. static UINT8 eeprom_data[128*2];
  80. static struct EEPROM_interface eeprom_interface =
  81. {
  82.     7,
  83.     16,
  84.     "000001100",
  85.     "000001010",
  86.     0,
  87.     "0000010000000000",
  88.     "0000010011000000",
  89.     1
  90. };
  91.  
  92.  
  93. /* Sound routines */
  94. WRITE_HANDLER( ataxx_i86_control_w );
  95. WRITE_HANDLER( leland_i86_command_lo_w );
  96. WRITE_HANDLER( leland_i86_command_hi_w );
  97. READ_HANDLER( leland_i86_response_r );
  98.  
  99. int  leland_i186_sh_start(const struct MachineSound *msound);
  100. void leland_i186_sound_init(void);
  101.  
  102. void leland_i86_optimize_address(offs_t offset);
  103.  
  104. extern struct MemoryReadAddress leland_i86_readmem[];
  105. extern struct MemoryWriteAddress leland_i86_writemem[];
  106. extern struct IOReadPort leland_i86_readport[];
  107. extern struct IOWritePort ataxx_i86_writeport[];
  108.  
  109.  
  110. /* Video routines */
  111. extern UINT8 *ataxx_qram;
  112.  
  113. READ_HANDLER( ataxx_mvram_port_r );
  114. READ_HANDLER( ataxx_svram_port_r );
  115. WRITE_HANDLER( ataxx_mvram_port_w );
  116. WRITE_HANDLER( ataxx_svram_port_w );
  117. WRITE_HANDLER( leland_master_video_addr_w );
  118. WRITE_HANDLER( leland_slave_video_addr_w );
  119.  
  120. WRITE_HANDLER( leland_gfx_port_w );
  121.  
  122. void leland_vh_eof(void);
  123. int ataxx_vh_start(void);
  124. void ataxx_vh_stop(void);
  125. void ataxx_vh_screenrefresh(struct osd_bitmap *bitmap, int full_refresh);
  126.  
  127.  
  128. /* Internal routines */
  129. static void interrupt_callback(int scanline);
  130. static void master_bankswitch(void);
  131.  
  132.  
  133.  
  134. /*************************************
  135.  *
  136.  *    Generic dial encoding
  137.  *
  138.  *************************************/
  139.  
  140. static int dial_compute_value(int new_val, int indx)
  141. {
  142.     int delta = new_val - (int)dial_last_input[indx];
  143.     UINT8 result = dial_last_result[indx] & 0x80;
  144.  
  145.     dial_last_input[indx] = new_val;
  146.  
  147.     if (delta > 0x80)
  148.         delta -= 0x100;
  149.     else if (delta < -0x80)
  150.         delta += 0x100;
  151.  
  152.     if (delta < 0)
  153.     {
  154.         result = 0x80;
  155.         delta = -delta;
  156.     }
  157.     else if (delta > 0)
  158.         result = 0x00;
  159.  
  160.     if (delta > 0x1f)
  161.         delta = 0x1f;
  162.     result |= (dial_last_result[indx] + delta) & 0x1f;
  163.  
  164.     dial_last_result[indx] = result;
  165.     return result;
  166. }
  167.  
  168.  
  169.  
  170. /*************************************
  171.  *
  172.  *    Ataxx inputs
  173.  *
  174.  *************************************/
  175.  
  176. static READ_HANDLER( ataxx_trackball_r )
  177. {
  178.     return dial_compute_value(readinputport(3 + offset), offset);
  179. }
  180.  
  181.  
  182.  
  183. /*************************************
  184.  *
  185.  *    Indy Heat inputs
  186.  *
  187.  *************************************/
  188.  
  189. static READ_HANDLER( indyheat_wheel_r )
  190. {
  191.     return dial_compute_value(readinputport(3 + offset), offset);
  192. }
  193.  
  194. static READ_HANDLER( indyheat_analog_r )
  195. {
  196.     switch (offset)
  197.     {
  198.         case 0:
  199.             return 0;
  200.  
  201.         case 1:
  202.             return analog_result;
  203.  
  204.         case 2:
  205.             return 0;
  206.  
  207.         case 3:
  208.             logerror("Unexpected analog read(%02X)\n", 8 + offset);
  209.             break;
  210.     }
  211.     return 0xff;
  212. }
  213.  
  214. static WRITE_HANDLER( indyheat_analog_w )
  215. {
  216.     switch (offset)
  217.     {
  218.         case 3:
  219.             analog_result = readinputport(6 + data);
  220.             break;
  221.  
  222.         case 0:
  223.         case 1:
  224.         case 2:
  225.             logerror("Unexpected analog write(%02X) = %02X\n", 8 + offset, data);
  226.             break;
  227.     }
  228. }
  229.  
  230.  
  231.  
  232. /*************************************
  233.  *
  234.  *    Machine initialization
  235.  *
  236.  *************************************/
  237.  
  238. static void init_machine(void)
  239. {
  240.     /* set the odd data banks */
  241.     battery_ram = memory_region(REGION_USER2);
  242.     extra_tram = battery_ram + battery_ram_size;
  243.  
  244.     /* initialize the XROM */
  245.     xrom_length = memory_region_length(REGION_USER1);
  246.     xrom_base = memory_region(REGION_USER1);
  247.     xrom1_addr = 0;
  248.     xrom2_addr = 0;
  249.  
  250.     /* start scanline interrupts going */
  251.     master_int_timer = timer_set(cpu_getscanlinetime(8), 8, interrupt_callback);
  252.  
  253.     /* reset globals */
  254.     wcol_enable = 0;
  255.  
  256.     analog_result = 0xff;
  257.     memset(dial_last_input, 0, sizeof(dial_last_input));
  258.     memset(dial_last_result, 0, sizeof(dial_last_result));
  259.  
  260.     master_bank = 0;
  261.  
  262.     /* initialize the master banks */
  263.     master_length = memory_region_length(REGION_CPU1);
  264.     master_base = memory_region(REGION_CPU1);
  265.     master_bankswitch();
  266.  
  267.     /* initialize the slave banks */
  268.     slave_length = memory_region_length(REGION_CPU2);
  269.     slave_base = memory_region(REGION_CPU2);
  270.     if (slave_length > 0x10000)
  271.         cpu_setbank(3, &slave_base[0x10000]);
  272.  
  273.     /* reset the I186 */
  274.     leland_i186_sound_init();
  275. }
  276.  
  277.  
  278.  
  279. /*************************************
  280.  *
  281.  *    Master CPU interrupt handling
  282.  *
  283.  *************************************/
  284.  
  285. static void interrupt_callback(int scanline)
  286. {
  287.     extern UINT8 leland_last_scanline_int;
  288.     leland_last_scanline_int = scanline;
  289.  
  290.     /* interrupts generated according to the interrupt control register */
  291.     cpu_cause_interrupt(0, 0);
  292.  
  293.     /* set a timer for the next one */
  294.     master_int_timer = timer_set(cpu_getscanlinetime(scanline), scanline, interrupt_callback);
  295. }
  296.  
  297.  
  298.  
  299. /*************************************
  300.  *
  301.  *    Master CPU bankswitch handlers
  302.  *
  303.  *************************************/
  304.  
  305. static void master_bankswitch(void)
  306. {
  307.     static const UINT32 bank_list[] =
  308.     {
  309.         0x02000, 0x18000, 0x20000, 0x28000, 0x30000, 0x38000, 0x40000, 0x48000,
  310.         0x50000, 0x58000, 0x60000, 0x68000, 0x70000, 0x78000, 0x80000, 0x88000
  311.     };
  312.     UINT8 *address;
  313.  
  314.     battery_ram_enable = ((master_bank & 0x30) == 0x10);
  315.  
  316.     address = &master_base[bank_list[master_bank & 15]];
  317.     if (bank_list[master_bank & 15] >= master_length)
  318.     {
  319.         logerror("%04X:Master bank %02X out of range!\n", cpu_getpreviouspc(), master_bank & 15);
  320.         address = &master_base[bank_list[0]];
  321.     }
  322.     cpu_setbank(1, address);
  323.  
  324.     if (battery_ram_enable)
  325.         address = battery_ram;
  326.     else if ((master_bank & 0x30) == 0x20)
  327.         address = &ataxx_qram[(master_bank & 0xc0) << 8];
  328.     else
  329.         address = &master_base[0xa000];
  330.     cpu_setbank(2, address);
  331.  
  332.     wcol_enable = ((master_bank & 0x30) == 0x30);
  333. }
  334.  
  335.  
  336.  
  337. /*************************************
  338.  *
  339.  *    EEPROM handling (128 x 16bits)
  340.  *
  341.  *************************************/
  342.  
  343. static void init_eeprom(UINT8 default_val, const UINT16 *data, UINT8 serial_offset)
  344. {
  345.     UINT32 serial;
  346.  
  347.     /* initialize everything to the default value */
  348.     memset(eeprom_data, default_val, sizeof(eeprom_data));
  349.  
  350.     /* fill in the preset data */
  351.     while (*data != 0xffff)
  352.     {
  353.         int offset = *data++;
  354.         int value = *data++;
  355.         eeprom_data[offset * 2 + 0] = value >> 8;
  356.         eeprom_data[offset * 2 + 1] = value & 0xff;
  357.     }
  358.  
  359.     /* pick a serial number -- examples of real serial numbers:
  360.  
  361.         WSF:         30101190
  362.         Indy Heat:   31201339
  363.     */
  364.     serial = 0x12345678;
  365.  
  366.     /* encrypt the serial number */
  367.     {
  368.         int d, e, h, l;
  369.  
  370.         /* break the serial number out into pieces */
  371.         l = (serial >> 24) & 0xff;
  372.         h = (serial >> 16) & 0xff;
  373.         e = (serial >> 8) & 0xff;
  374.         d = serial & 0xff;
  375.  
  376.         /* decrypt the data */
  377.         h = ((h ^ 0x2a ^ l) ^ 0xff) + 5;
  378.         d = ((d + 0x2a) ^ e) ^ 0xff;
  379.         l ^= e;
  380.         e ^= 0x2a;
  381.  
  382.         /* store the bytes */
  383.         eeprom_data[serial_offset * 2 + 0] = h;
  384.         eeprom_data[serial_offset * 2 + 1] = l;
  385.         eeprom_data[serial_offset * 2 + 2] = d;
  386.         eeprom_data[serial_offset * 2 + 3] = e;
  387.     }
  388.  
  389.     /* compute the checksum */
  390.     {
  391.         int i, sum = 0;
  392.         for (i = 0; i < 0x7f * 2; i++)
  393.             sum += eeprom_data[i];
  394.         sum ^= 0xffff;
  395.         eeprom_data[0x7f * 2 + 0] = (sum >> 8) & 0xff;
  396.         eeprom_data[0x7f * 2 + 1] = sum & 0xff;
  397.  
  398.         EEPROM_init(&eeprom_interface);
  399.     }
  400. }
  401.  
  402.  
  403.  
  404. /*************************************
  405.  *
  406.  *    Battery backed RAM
  407.  *
  408.  *************************************/
  409.  
  410. static WRITE_HANDLER( battery_ram_w )
  411. {
  412.     if (battery_ram_enable)
  413.     {
  414.         if (LOG_BATTERY_RAM) logerror("%04X:BatteryW@%04X=%02X\n", cpu_getpreviouspc(), offset, data);
  415.         battery_ram[offset] = data;
  416.     }
  417.     else if ((master_bank & 0x30) == 0x20)
  418.         ataxx_qram[((master_bank & 0xc0) << 8) + offset] = data;
  419.     else
  420.         logerror("%04X:BatteryW@%04X (invalid!)\n", cpu_getpreviouspc(), offset, data);
  421. }
  422.  
  423.  
  424. static void nvram_handler(void *file, int read_or_write)
  425. {
  426.     if (read_or_write)
  427.     {
  428.         EEPROM_save(file);
  429.         osd_fwrite(file, memory_region(REGION_USER2), battery_ram_size);
  430.     }
  431.     else if (file)
  432.     {
  433.         EEPROM_load(file);
  434.         osd_fread(file, memory_region(REGION_USER2), battery_ram_size);
  435.     }
  436.     else
  437.     {
  438.         EEPROM_set_data(eeprom_data, 128*2);
  439.         memset(memory_region(REGION_USER2), 0x00, battery_ram_size);
  440.     }
  441. }
  442.  
  443.  
  444.  
  445. /*************************************
  446.  *
  447.  *    Master CPU internal I/O
  448.  *
  449.  *************************************/
  450.  
  451. static READ_HANDLER( master_input_r )
  452. {
  453.     int result = 0xff;
  454.  
  455.     switch (offset)
  456.     {
  457.         case 0x06:    /* /GIN0 */
  458.             result = readinputport(0);
  459.             break;
  460.  
  461.         case 0x07:    /* /SLVBLK */
  462.             result = readinputport(1);
  463.             if (cpunum_get_reg(1, Z80_HALT))
  464.                 result ^= 0x01;
  465.             break;
  466.  
  467.         default:
  468.             logerror("Master I/O read offset %02X\n", offset);
  469.             break;
  470.     }
  471.     return result;
  472. }
  473.  
  474.  
  475. static WRITE_HANDLER( master_output_w )
  476. {
  477.     switch (offset)
  478.     {
  479.         case 0x00:    /* /BKXL */
  480.         case 0x01:    /* /BKXH */
  481.         case 0x02:    /* /BKYL */
  482.         case 0x03:    /* /BKYH */
  483.             leland_gfx_port_w(offset, data);
  484.             break;
  485.  
  486.         case 0x04:    /* /MBNK */
  487.             if (LOG_BANKSWITCHING_M)
  488.                 if ((master_bank ^ data) & 0xff)
  489.                     logerror("%04X:master_bank = %02X\n", cpu_getpreviouspc(), data & 0xff);
  490.             master_bank = data;
  491.             master_bankswitch();
  492.             break;
  493.  
  494.         case 0x05:    /* /SLV0 */
  495.             cpu_set_irq_line  (1, 0, (data & 0x01) ? CLEAR_LINE : ASSERT_LINE);
  496.             cpu_set_nmi_line  (1,    (data & 0x04) ? CLEAR_LINE : ASSERT_LINE);
  497.             cpu_set_reset_line(1,    (data & 0x10) ? CLEAR_LINE : ASSERT_LINE);
  498.             break;
  499.  
  500.         case 0x08:    /*  */
  501.             if (master_int_timer)
  502.                 timer_remove(master_int_timer);
  503.             master_int_timer = timer_set(cpu_getscanlinetime(data + 1), data + 1, interrupt_callback);
  504.             break;
  505.  
  506.         default:
  507.             logerror("Master I/O write offset %02X=%02X\n", offset, data);
  508.             break;
  509.     }
  510. }
  511.  
  512.  
  513. static READ_HANDLER( eeprom_r )
  514. {
  515.     int port = readinputport(2);
  516.     if (LOG_EEPROM) logerror("%04X:EE read\n", cpu_getpreviouspc());
  517.     return (port & ~0x01) | EEPROM_read_bit();
  518. }
  519.  
  520.  
  521. static WRITE_HANDLER( eeprom_w )
  522. {
  523.     if (LOG_EEPROM) logerror("%04X:EE write %d%d%d\n", cpu_getpreviouspc(),
  524.             (data >> 6) & 1, (data >> 5) & 1, (data >> 4) & 1);
  525.     EEPROM_write_bit     ((data & 0x10) >> 4);
  526.     EEPROM_set_clock_line((data & 0x20) ? ASSERT_LINE : CLEAR_LINE);
  527.     EEPROM_set_cs_line  ((~data & 0x40) ? ASSERT_LINE : CLEAR_LINE);
  528. }
  529.  
  530.  
  531.  
  532. /*************************************
  533.  *
  534.  *    Master CPU palette gates
  535.  *
  536.  *************************************/
  537.  
  538. static WRITE_HANDLER( paletteram_and_misc_w )
  539. {
  540.     if (wcol_enable)
  541.         paletteram_xxxxRRRRGGGGBBBB_w(offset, data);
  542.     else if (offset == 0x7f8 || offset == 0x7f9)
  543.         leland_master_video_addr_w(offset - 0x7f8, data);
  544.     else if (offset == 0x7fc)
  545.     {
  546.         xrom1_addr = (xrom1_addr & 0xff00) | (data & 0x00ff);
  547.         if (LOG_XROM) logerror("%04X:XROM1 address low write = %02X (addr=%04X)\n", cpu_getpreviouspc(), data, xrom1_addr);
  548.     }
  549.     else if (offset == 0x7fd)
  550.     {
  551.         xrom1_addr = (xrom1_addr & 0x00ff) | ((data << 8) & 0xff00);
  552.         if (LOG_XROM) logerror("%04X:XROM1 address high write = %02X (addr=%04X)\n", cpu_getpreviouspc(), data, xrom1_addr);
  553.     }
  554.     else if (offset == 0x7fe)
  555.     {
  556.         xrom2_addr = (xrom2_addr & 0xff00) | (data & 0x00ff);
  557.         if (LOG_XROM) logerror("%04X:XROM2 address low write = %02X (addr=%04X)\n", cpu_getpreviouspc(), data, xrom2_addr);
  558.     }
  559.     else if (offset == 0x7ff)
  560.     {
  561.         xrom2_addr = (xrom2_addr & 0x00ff) | ((data << 8) & 0xff00);
  562.         if (LOG_XROM) logerror("%04X:XROM2 address high write = %02X (addr=%04X)\n", cpu_getpreviouspc(), data, xrom2_addr);
  563.     }
  564.     else
  565.         extra_tram[offset] = data;
  566. }
  567.  
  568.  
  569. static READ_HANDLER( paletteram_and_misc_r )
  570. {
  571.     if (wcol_enable)
  572.         return paletteram_r(offset);
  573.     else if (offset == 0x7fc || offset == 0x7fd)
  574.     {
  575.         int result = xrom_base[0x00000 | xrom1_addr | ((offset & 1) << 16)];
  576.         if (LOG_XROM) logerror("%04X:XROM1 read(%d) = %02X (addr=%04X)\n", cpu_getpreviouspc(), offset - 0x7fc, result, xrom1_addr);
  577.         return result;
  578.     }
  579.     else if (offset == 0x7fe || offset == 0x7ff)
  580.     {
  581.         int result = xrom_base[0x20000 | xrom2_addr | ((offset & 1) << 16)];
  582.         if (LOG_XROM) logerror("%04X:XROM2 read(%d) = %02X (addr=%04X)\n", cpu_getpreviouspc(), offset - 0x7fc, result, xrom2_addr);
  583.         return result;
  584.     }
  585.     else
  586.         return extra_tram[offset];
  587. }
  588.  
  589.  
  590.  
  591. /*************************************
  592.  *
  593.  *    Slave CPU bankswitching
  594.  *
  595.  *************************************/
  596.  
  597. static WRITE_HANDLER( slave_banksw_w )
  598. {
  599.     int bankaddress, bank = data & 15;
  600.  
  601.     if (bank == 0)
  602.         bankaddress = 0x2000;
  603.     else
  604.     {
  605.         bankaddress = 0x10000 * bank + 0x8000 * ((data >> 4) & 1);
  606.         if (slave_length > 0x100000)
  607.             bankaddress += 0x100000 * ((data >> 5) & 1);
  608.     }
  609.  
  610.     if (bankaddress >= slave_length)
  611.     {
  612.         logerror("%04X:Slave bank %02X out of range!", cpu_getpreviouspc(), data & 0x3f);
  613.         bankaddress = 0x2000;
  614.     }
  615.     cpu_setbank(3, &slave_base[bankaddress]);
  616.  
  617.     if (LOG_BANKSWITCHING_S) logerror("%04X:Slave bank = %02X (%05X)\n", cpu_getpreviouspc(), data, bankaddress);
  618. }
  619.  
  620.  
  621.  
  622. /*************************************
  623.  *
  624.  *    Slave CPU I/O
  625.  *
  626.  *************************************/
  627.  
  628. static READ_HANDLER( raster_r )
  629. {
  630.     int scanline = cpu_getscanline();
  631.     return (scanline < 255) ? scanline : 255;
  632. }
  633.  
  634.  
  635.  
  636. /*************************************
  637.  *
  638.  *    Master CPU memory handlers
  639.  *
  640.  *************************************/
  641.  
  642. static struct MemoryReadAddress master_readmem[] =
  643. {
  644.     { 0x0000, 0x1fff, MRA_ROM },
  645.     { 0x2000, 0x9fff, MRA_BANK1 },
  646.     { 0xa000, 0xdfff, MRA_BANK2 },
  647.     { 0xe000, 0xf7ff, MRA_RAM },
  648.     { 0xf800, 0xffff, paletteram_and_misc_r },
  649.     { -1 }  /* end of table */
  650. };
  651.  
  652. static struct MemoryWriteAddress master_writemem[] =
  653. {
  654.     { 0x0000, 0x9fff, MWA_ROM },
  655.     { 0xa000, 0xdfff, battery_ram_w },
  656.     { 0xe000, 0xf7ff, MWA_RAM },
  657.     { 0xf800, 0xffff, paletteram_and_misc_w, &paletteram },
  658.     { -1 }  /* end of table */
  659. };
  660.  
  661. static struct IOReadPort master_readport[] =
  662. {
  663.     { 0x04, 0x04, leland_i86_response_r },
  664.     { 0x20, 0x20, eeprom_r },
  665.     { 0xd0, 0xef, ataxx_mvram_port_r },
  666.     { 0xf0, 0xff, master_input_r },
  667.     { -1 }  /* end of table */
  668. };
  669.  
  670. static struct IOWritePort master_writeport[] =
  671. {
  672.     { 0x05, 0x05, leland_i86_command_hi_w },
  673.     { 0x06, 0x06, leland_i86_command_lo_w },
  674.     { 0x0c, 0x0c, ataxx_i86_control_w },
  675.     { 0x20, 0x20, eeprom_w },
  676.     { 0xd0, 0xef, ataxx_mvram_port_w },
  677.     { 0xf0, 0xff, master_output_w },
  678.     { -1 }  /* end of table */
  679. };
  680.  
  681.  
  682.  
  683.  
  684. /*************************************
  685.  *
  686.  *    Slave CPU memory handlers
  687.  *
  688.  *************************************/
  689.  
  690. static struct MemoryReadAddress slave_readmem[] =
  691. {
  692.     { 0x0000, 0x1fff, MRA_ROM },
  693.     { 0x2000, 0x9fff, MRA_BANK3 },
  694.     { 0xa000, 0xdfff, MRA_ROM },
  695.     { 0xe000, 0xefff, MRA_RAM },
  696.     { 0xfffe, 0xfffe, raster_r },
  697.     { -1 }  /* end of table */
  698. };
  699.  
  700. static struct MemoryWriteAddress slave_writemem[] =
  701. {
  702.     { 0x0000, 0xdfff, MWA_ROM },
  703.     { 0xe000, 0xefff, MWA_RAM },
  704.     { 0xfffc, 0xfffd, leland_slave_video_addr_w },
  705.     { 0xffff, 0xffff, slave_banksw_w },
  706.     { -1 }  /* end of table */
  707. };
  708.  
  709. static struct IOReadPort slave_readport[] =
  710. {
  711.     { 0x60, 0x7f, ataxx_svram_port_r },
  712.     { -1 }  /* end of table */
  713. };
  714.  
  715. static struct IOWritePort slave_writeport[] =
  716. {
  717.     { 0x60, 0x7f, ataxx_svram_port_w },
  718.     { -1 }  /* end of table */
  719. };
  720.  
  721.  
  722.  
  723. /*************************************
  724.  *
  725.  *    Port definitions
  726.  *
  727.  *************************************/
  728.  
  729. INPUT_PORTS_START( ataxx )
  730.     PORT_START        /* 0xF6 */
  731.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
  732.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
  733.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )    /* huh? affects trackball movement */
  734.     PORT_SERVICE_NO_TOGGLE( 0x08, IP_ACTIVE_LOW )
  735.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START1 )
  736.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER1 )
  737.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START2 )
  738.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )
  739.  
  740.     PORT_START        /* 0xF7 */
  741.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SLAVEHALT )
  742.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_VBLANK )
  743.     PORT_BIT( 0xfc, IP_ACTIVE_LOW, IPT_UNUSED )
  744.  
  745.     PORT_START        /* 0x20 */
  746.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_EEPROM_DATA )
  747.     PORT_BIT( 0xfe, IP_ACTIVE_LOW, IPT_UNUSED )
  748.  
  749.     PORT_START        /* 0x00 - analog X */
  750.     PORT_ANALOG( 0xff, 0x00, IPT_TRACKBALL_X | IPF_PLAYER1, 100, 10, 0, 255 )
  751.     PORT_START        /* 0x01 - analog Y */
  752.     PORT_ANALOG( 0xff, 0x00, IPT_TRACKBALL_Y | IPF_PLAYER1, 100, 10, 0, 255 )
  753.     PORT_START        /* 0x02 - analog X */
  754.     PORT_ANALOG( 0xff, 0x00, IPT_TRACKBALL_X | IPF_PLAYER2, 100, 10, 0, 255 )
  755.     PORT_START        /* 0x03 - analog Y */
  756.     PORT_ANALOG( 0xff, 0x00, IPT_TRACKBALL_Y | IPF_PLAYER2, 100, 10, 0, 255 )
  757. INPUT_PORTS_END
  758.  
  759.  
  760. INPUT_PORTS_START( wsf )
  761.     PORT_START        /* 0xF6 */
  762.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
  763.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
  764.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN3 )
  765.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN4 )
  766.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER1 )
  767.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER2 )
  768.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER3 )
  769.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER4 )
  770.  
  771.     PORT_START        /* 0xF7 */
  772.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SLAVEHALT )
  773.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_VBLANK )
  774.     PORT_BIT( 0xfc, IP_ACTIVE_LOW, IPT_UNUSED )
  775.  
  776.     PORT_START        /* 0x20 */
  777.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_EEPROM_DATA )
  778.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
  779.     PORT_SERVICE_NO_TOGGLE( 0x04, IP_ACTIVE_LOW )
  780.     PORT_BIT( 0xf8, IP_ACTIVE_LOW, IPT_UNUSED )
  781.  
  782.     PORT_START        /* 0x0D */
  783.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_PLAYER2 )
  784.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY | IPF_PLAYER2 )
  785.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY | IPF_PLAYER2 )
  786.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY | IPF_PLAYER2 )
  787.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_PLAYER1 )
  788.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY | IPF_PLAYER1 )
  789.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY | IPF_PLAYER1 )
  790.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY | IPF_PLAYER1 )
  791.  
  792.     PORT_START        /* 0x0E */
  793.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_PLAYER4 )
  794.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY | IPF_PLAYER4 )
  795.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY | IPF_PLAYER4 )
  796.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY | IPF_PLAYER4 )
  797.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_PLAYER3 )
  798.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY | IPF_PLAYER3 )
  799.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY | IPF_PLAYER3 )
  800.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY | IPF_PLAYER3 )
  801.  
  802.     PORT_START        /* 0x0F */
  803.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )
  804.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
  805.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER1 )
  806.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 )
  807.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER3 )
  808.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START3 )
  809.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER4 )
  810.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START4 )
  811. INPUT_PORTS_END
  812.  
  813.  
  814. INPUT_PORTS_START( indyheat )
  815.     PORT_START        /* 0xF6 */
  816.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
  817.     PORT_BIT_IMPULSE( 0x02, IP_ACTIVE_HIGH, IPT_COIN1, 1 )
  818.     PORT_BIT_IMPULSE( 0x04, IP_ACTIVE_HIGH, IPT_COIN2, 1 )
  819.     PORT_BIT_IMPULSE( 0x08, IP_ACTIVE_HIGH, IPT_COIN3, 1 )
  820.     PORT_BIT( 0x70, IP_ACTIVE_LOW, IPT_UNUSED )
  821.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_PLAYER1 )
  822.  
  823.     PORT_START        /* 0xF7 */
  824.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SLAVEHALT )
  825.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_VBLANK )
  826.     PORT_BIT( 0xfc, IP_ACTIVE_LOW, IPT_UNUSED )
  827.  
  828.     PORT_START        /* 0x20 */
  829.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_EEPROM_DATA )
  830.     PORT_BIT( 0xfe, IP_ACTIVE_LOW, IPT_UNUSED )
  831.  
  832.     PORT_START      /* Analog wheel 1 */
  833.     PORT_ANALOG( 0xff, 0x80, IPT_DIAL | IPF_PLAYER1, 100, 10, 0, 255 )
  834.     PORT_START      /* Analog wheel 2 */
  835.     PORT_ANALOG( 0xff, 0x80, IPT_DIAL | IPF_PLAYER2, 100, 10, 0, 255 )
  836.     PORT_START      /* Analog wheel 3 */
  837.     PORT_ANALOG( 0xff, 0x80, IPT_DIAL | IPF_PLAYER3, 100, 10, 0, 255 )
  838.     PORT_START      /* Analog pedal 1 */
  839.     PORT_ANALOG( 0xff, 0x00, IPT_PEDAL | IPF_PLAYER1, 100, 10, 0, 255 )
  840.     PORT_START      /* Analog pedal 2 */
  841.     PORT_ANALOG( 0xff, 0x00, IPT_PEDAL | IPF_PLAYER2, 100, 10, 0, 255 )
  842.     PORT_START      /* Analog pedal 3 */
  843.     PORT_ANALOG( 0xff, 0x00, IPT_PEDAL | IPF_PLAYER3, 100, 10, 0, 255 )
  844.  
  845.     PORT_START        /* 0x0D */
  846.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER1 )
  847.     PORT_BIT( 0xfe, IP_ACTIVE_LOW, IPT_UNUSED )
  848.  
  849.     PORT_START        /* 0x0E */
  850.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER2 )
  851.     PORT_BIT( 0xfe, IP_ACTIVE_LOW, IPT_UNUSED )
  852.  
  853.     PORT_START        /* 0x0F */
  854.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_PLAYER3 )
  855.     PORT_BIT( 0x7e, IP_ACTIVE_LOW, IPT_UNUSED )
  856.     PORT_SERVICE_NO_TOGGLE( 0x80, IP_ACTIVE_LOW )
  857. INPUT_PORTS_END
  858.  
  859.  
  860.  
  861. /*************************************
  862.  *
  863.  *    Graphics definitions
  864.  *
  865.  *************************************/
  866.  
  867. static struct GfxLayout bklayout =
  868. {
  869.     8,8,
  870.     RGN_FRAC(1,6),
  871.     6,
  872.     { RGN_FRAC(5,6), RGN_FRAC(4,6), RGN_FRAC(3,6), RGN_FRAC(2,6), RGN_FRAC(1,6), RGN_FRAC(0,6) },
  873.     { 0, 1, 2, 3, 4, 5, 6, 7 },
  874.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
  875.     8*8
  876. };
  877.  
  878. static struct GfxDecodeInfo gfxdecodeinfo[] =
  879. {
  880.     { REGION_GFX1, 0, &bklayout, 0, 1 },
  881.     { -1 } /* end of array */
  882. };
  883.  
  884.  
  885.  
  886. /*************************************
  887.  *
  888.  *    Sound definitions
  889.  *
  890.  *************************************/
  891.  
  892. static struct YM2151interface ym2151_interface =
  893. {
  894.     1,
  895.     4000000,
  896.     { YM3012_VOL(40,MIXER_PAN_LEFT,40,MIXER_PAN_RIGHT) },
  897.     { 0 }
  898. };
  899.  
  900. static struct CustomSound_interface i186_custom_interface =
  901. {
  902.     leland_i186_sh_start
  903. };
  904.  
  905.  
  906.  
  907. /*************************************
  908.  *
  909.  *    Machine driver
  910.  *
  911.  *************************************/
  912.  
  913. static struct MachineDriver machine_driver_ataxx =
  914. {
  915.     /* basic machine hardware */
  916.     {
  917.         {
  918.             CPU_Z80,
  919.             6000000,
  920.             master_readmem,master_writemem,
  921.             master_readport,master_writeport,
  922.             ignore_interrupt,1
  923.         },
  924.         {
  925.             CPU_Z80,
  926.             6000000,
  927.             slave_readmem,slave_writemem,
  928.             slave_readport,slave_writeport,
  929.             ignore_interrupt,1
  930.         },
  931.         {
  932.             CPU_I186 | CPU_AUDIO_CPU,
  933.             16000000/2,
  934.             leland_i86_readmem,leland_i86_writemem,
  935.             leland_i86_readport,ataxx_i86_writeport,
  936.             ignore_interrupt,1
  937.         }
  938.     },
  939.     60, (1000000*16)/(256*60),
  940.     1,
  941.     init_machine,
  942.  
  943.     /* video hardware */
  944.     40*8, 30*8, { 0*8, 40*8-1, 0*8, 30*8-1 },
  945.     gfxdecodeinfo,
  946.     1024,1024,
  947.     0,
  948.  
  949.     VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE,
  950.     leland_vh_eof,
  951.     ataxx_vh_start,
  952.     ataxx_vh_stop,
  953.     ataxx_vh_screenrefresh,
  954.  
  955.     /* sound hardware */
  956.     0,0,0,0,
  957.     {
  958.         { SOUND_CUSTOM, &i186_custom_interface },
  959.     },
  960.     nvram_handler
  961. };
  962.  
  963.  
  964. static struct MachineDriver machine_driver_wsf =
  965. {
  966.     /* basic machine hardware */
  967.     {
  968.         {
  969.             CPU_Z80,
  970.             6000000,
  971.             master_readmem,master_writemem,
  972.             master_readport,master_writeport,
  973.             ignore_interrupt,1
  974.         },
  975.         {
  976.             CPU_Z80,
  977.             6000000,
  978.             slave_readmem,slave_writemem,
  979.             slave_readport,slave_writeport,
  980.             ignore_interrupt,1
  981.         },
  982.         {
  983.             CPU_I186 | CPU_AUDIO_CPU,
  984.             16000000/2,
  985.             leland_i86_readmem,leland_i86_writemem,
  986.             leland_i86_readport,ataxx_i86_writeport,
  987.             ignore_interrupt,1
  988.         }
  989.     },
  990.     60, (1000000*16)/(256*60),
  991.     1,
  992.     init_machine,
  993.  
  994.     /* video hardware */
  995.     40*8, 30*8, { 0*8, 40*8-1, 0*8, 30*8-1 },
  996.     gfxdecodeinfo,
  997.     1024,1024,
  998.     0,
  999.  
  1000.     VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE,
  1001.     leland_vh_eof,
  1002.     ataxx_vh_start,
  1003.     ataxx_vh_stop,
  1004.     ataxx_vh_screenrefresh,
  1005.  
  1006.     /* sound hardware */
  1007.     0,0,0,0,
  1008.     {
  1009.         { SOUND_CUSTOM, &i186_custom_interface },
  1010.         { SOUND_YM2151, &ym2151_interface },
  1011.     },
  1012.     nvram_handler
  1013. };
  1014.  
  1015.  
  1016.  
  1017. /*************************************
  1018.  *
  1019.  *    ROM definitions
  1020.  *
  1021.  *************************************/
  1022.  
  1023. ROM_START( ataxx )
  1024.     ROM_REGION( 0x30000, REGION_CPU1 )
  1025.     ROM_LOAD( "ataxx.038",   0x00000, 0x20000, 0x0e1cf6236 )
  1026.     ROM_RELOAD(              0x10000, 0x20000 )
  1027.  
  1028.     ROM_REGION( 0x60000, REGION_CPU2 )
  1029.     ROM_LOAD( "ataxx.111",  0x00000, 0x20000, 0x09a3297cc )
  1030.     ROM_LOAD( "ataxx.112",  0x20000, 0x20000, 0x07e7c3e2f )
  1031.     ROM_LOAD( "ataxx.113",  0x40000, 0x20000, 0x08cf3e101 )
  1032.  
  1033.     ROM_REGION( 0x100000, REGION_CPU3 )
  1034.     ROM_LOAD_V20_EVEN( "ataxx.015",  0x20000, 0x20000, 0x08bb3233b )
  1035.     ROM_LOAD_V20_ODD ( "ataxx.001",  0x20000, 0x20000, 0x0728d75f2 )
  1036.     ROM_LOAD_V20_EVEN( "ataxx.016",  0x60000, 0x20000, 0x0f2bdff48 )
  1037.     ROM_RELOAD_V20_EVEN(             0xc0000, 0x20000 )
  1038.     ROM_LOAD_V20_ODD ( "ataxx.002",  0x60000, 0x20000, 0x0ca06a394 )
  1039.     ROM_RELOAD_V20_ODD(              0xc0000, 0x20000 )
  1040.  
  1041.     ROM_REGION( 0xc0000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  1042.     ROM_LOAD( "ataxx.098",  0x00000, 0x20000, 0x059d0f2ae )
  1043.     ROM_LOAD( "ataxx.099",  0x20000, 0x20000, 0x06ab7db25 )
  1044.     ROM_LOAD( "ataxx.100",  0x40000, 0x20000, 0x02352849e )
  1045.     ROM_LOAD( "ataxx.101",  0x60000, 0x20000, 0x04c31e02b )
  1046.     ROM_LOAD( "ataxx.102",  0x80000, 0x20000, 0x0a951228c )
  1047.     ROM_LOAD( "ataxx.103",  0xa0000, 0x20000, 0x0ed326164 )
  1048.  
  1049.     ROM_REGION( 0x00001, REGION_USER1 ) /* X-ROM (data used by main processor) */
  1050.     /* Empty / not used */
  1051.  
  1052.     ROM_REGION( battery_ram_size + extra_tram_size, REGION_USER2 ) /* extra RAM regions */
  1053. ROM_END
  1054.  
  1055. ROM_START( ataxxa )
  1056.     ROM_REGION( 0x30000, REGION_CPU1 )
  1057.     ROM_LOAD( "u38",   0x00000, 0x20000, 0x3378937d )
  1058.     ROM_RELOAD(        0x10000, 0x20000 )
  1059.  
  1060.     ROM_REGION( 0x60000, REGION_CPU2 )
  1061.     ROM_LOAD( "ataxx.111",  0x00000, 0x20000, 0x09a3297cc )
  1062.     ROM_LOAD( "ataxx.112",  0x20000, 0x20000, 0x07e7c3e2f )
  1063.     ROM_LOAD( "ataxx.113",  0x40000, 0x20000, 0x08cf3e101 )
  1064.  
  1065.     ROM_REGION( 0x100000, REGION_CPU3 )
  1066.     ROM_LOAD_V20_EVEN( "ataxx.015",  0x20000, 0x20000, 0x08bb3233b )
  1067.     ROM_LOAD_V20_ODD ( "ataxx.001",  0x20000, 0x20000, 0x0728d75f2 )
  1068.     ROM_LOAD_V20_EVEN( "ataxx.016",  0x60000, 0x20000, 0x0f2bdff48 )
  1069.     ROM_RELOAD_V20_EVEN(             0xc0000, 0x20000 )
  1070.     ROM_LOAD_V20_ODD ( "ataxx.002",  0x60000, 0x20000, 0x0ca06a394 )
  1071.     ROM_RELOAD_V20_ODD(              0xc0000, 0x20000 )
  1072.  
  1073.     ROM_REGION( 0xc0000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  1074.     ROM_LOAD( "ataxx.098",  0x00000, 0x20000, 0x059d0f2ae )
  1075.     ROM_LOAD( "ataxx.099",  0x20000, 0x20000, 0x06ab7db25 )
  1076.     ROM_LOAD( "ataxx.100",  0x40000, 0x20000, 0x02352849e )
  1077.     ROM_LOAD( "ataxx.101",  0x60000, 0x20000, 0x04c31e02b )
  1078.     ROM_LOAD( "ataxx.102",  0x80000, 0x20000, 0x0a951228c )
  1079.     ROM_LOAD( "ataxx.103",  0xa0000, 0x20000, 0x0ed326164 )
  1080.  
  1081.     ROM_REGION( 0x00001, REGION_USER1 ) /* X-ROM (data used by main processor) */
  1082.     /* Empty / not used */
  1083.  
  1084.     ROM_REGION( battery_ram_size + extra_tram_size, REGION_USER2 ) /* extra RAM regions */
  1085. ROM_END
  1086.  
  1087. ROM_START( ataxxj )
  1088.     ROM_REGION( 0x30000, REGION_CPU1 )
  1089.     ROM_LOAD( "ataxxj.038", 0x00000, 0x20000, 0x513fa7d4 )
  1090.     ROM_RELOAD(             0x10000, 0x20000 )
  1091.  
  1092.     ROM_REGION( 0x60000, REGION_CPU2 )
  1093.     ROM_LOAD( "ataxx.111",  0x00000, 0x20000, 0x09a3297cc )
  1094.     ROM_LOAD( "ataxx.112",  0x20000, 0x20000, 0x07e7c3e2f )
  1095.     ROM_LOAD( "ataxx.113",  0x40000, 0x20000, 0x08cf3e101 )
  1096.  
  1097.     ROM_REGION( 0x100000, REGION_CPU3 )
  1098.     ROM_LOAD_V20_EVEN( "ataxxj.015", 0x20000, 0x20000, 0xdb266d3f )
  1099.     ROM_LOAD_V20_ODD ( "ataxxj.001", 0x20000, 0x20000, 0xd6db2724 )
  1100.     ROM_LOAD_V20_EVEN( "ataxxj.016", 0x60000, 0x20000, 0x2b127f56 )
  1101.     ROM_RELOAD_V20_EVEN(             0xc0000, 0x20000 )
  1102.     ROM_LOAD_V20_ODD ( "ataxxj.002", 0x60000, 0x20000, 0x1b63b882 )
  1103.     ROM_RELOAD_V20_ODD(              0xc0000, 0x20000 )
  1104.  
  1105.     ROM_REGION( 0xc0000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  1106.     ROM_LOAD( "ataxx.098",  0x00000, 0x20000, 0x059d0f2ae )
  1107.     ROM_LOAD( "ataxx.099",  0x20000, 0x20000, 0x06ab7db25 )
  1108.     ROM_LOAD( "ataxx.100",  0x40000, 0x20000, 0x02352849e )
  1109.     ROM_LOAD( "ataxx.101",  0x60000, 0x20000, 0x04c31e02b )
  1110.     ROM_LOAD( "ataxx.102",  0x80000, 0x20000, 0x0a951228c )
  1111.     ROM_LOAD( "ataxx.103",  0xa0000, 0x20000, 0x0ed326164 )
  1112.  
  1113.     ROM_REGION( 0x00001, REGION_USER1 ) /* X-ROM (data used by main processor) */
  1114.     /* Empty / not used */
  1115.  
  1116.     ROM_REGION( battery_ram_size + extra_tram_size, REGION_USER2 ) /* extra RAM regions */
  1117. ROM_END
  1118.  
  1119. ROM_START( wsf )
  1120.     ROM_REGION( 0x50000, REGION_CPU1 )
  1121.     ROM_LOAD( "30022-03.u64",  0x00000, 0x20000, 0x2e7faa96 )
  1122.     ROM_RELOAD(                0x10000, 0x20000 )
  1123.     ROM_LOAD( "30023-03.u65",  0x30000, 0x20000, 0x7146328f )
  1124.  
  1125.     ROM_REGION( 0x100000, REGION_CPU2 )
  1126.     ROM_LOAD( "30001-01.151",  0x00000, 0x20000, 0x31c63af5 )
  1127.     ROM_LOAD( "30002-01.152",  0x20000, 0x20000, 0xa53e88a6 )
  1128.     ROM_LOAD( "30003-01.153",  0x40000, 0x20000, 0x12afad1d )
  1129.     ROM_LOAD( "30004-01.154",  0x60000, 0x20000, 0xb8b3d59c )
  1130.     ROM_LOAD( "30005-01.155",  0x80000, 0x20000, 0x505724b9 )
  1131.     ROM_LOAD( "30006-01.156",  0xa0000, 0x20000, 0xc86b5c4d )
  1132.     ROM_LOAD( "30007-01.157",  0xc0000, 0x20000, 0x451321ae )
  1133.     ROM_LOAD( "30008-01.158",  0xe0000, 0x20000, 0x4d23836f )
  1134.  
  1135.     ROM_REGION( 0x100000, REGION_CPU3 )
  1136.     ROM_LOAD_V20_EVEN( "30017-01.u3",  0x20000, 0x20000, 0x39ec13c1 )
  1137.     ROM_LOAD_V20_ODD ( "30020-01.u6",  0x20000, 0x20000, 0x532c02bf )
  1138.     ROM_LOAD_V20_EVEN( "30018-01.u4",  0x60000, 0x20000, 0x1ec16735 )
  1139.     ROM_RELOAD_V20_EVEN(               0xc0000, 0x20000 )
  1140.     ROM_LOAD_V20_ODD ( "30019-01.u5",  0x60000, 0x20000, 0x2881f73b )
  1141.     ROM_RELOAD_V20_ODD (               0xc0000, 0x20000 )
  1142.  
  1143.     ROM_REGION( 0x60000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  1144.     ROM_LOAD( "30011-02.145",  0x00000, 0x10000, 0x6153569b )
  1145.     ROM_LOAD( "30012-02.146",  0x10000, 0x10000, 0x52d65e21 )
  1146.     ROM_LOAD( "30013-02.147",  0x20000, 0x10000, 0xb3afda12 )
  1147.     ROM_LOAD( "30014-02.148",  0x30000, 0x10000, 0x624e6c64 )
  1148.     ROM_LOAD( "30015-01.149",  0x40000, 0x10000, 0x5d9064f2 )
  1149.     ROM_LOAD( "30016-01.150",  0x50000, 0x10000, 0xd76389cd )
  1150.  
  1151.     ROM_REGION( 0x20000, REGION_USER1 ) /* X-ROM (data used by main processor) */
  1152.     ROM_LOAD( "30009-01.u68",  0x00000, 0x10000, 0xf2fbfc15 )
  1153.     ROM_LOAD( "30010-01.u69",  0x10000, 0x10000, 0xb4ed2d3b )
  1154.  
  1155.     ROM_REGION( 0x20000, REGION_SOUND1 ) /* externally clocked DAC data */
  1156.     ROM_LOAD( "30021-01.u8",   0x00000, 0x20000, 0xbb91dc10 )
  1157.  
  1158.     ROM_REGION( battery_ram_size + extra_tram_size, REGION_USER2 ) /* extra RAM regions */
  1159. ROM_END
  1160.  
  1161. ROM_START( indyheat )
  1162.     ROM_REGION( 0x90000, REGION_CPU1 )
  1163.     ROM_LOAD( "u64_27c.010",   0x00000, 0x20000, 0x2b97a347 )
  1164.     ROM_RELOAD(                0x10000, 0x20000 )
  1165.     ROM_LOAD( "u65_27c.010",   0x30000, 0x20000, 0x71301d74 )
  1166.     ROM_LOAD( "u66_27c.010",   0x50000, 0x20000, 0xc9612072 )
  1167.     ROM_LOAD( "u67_27c.010",   0x70000, 0x20000, 0x4c4b25e0 )
  1168.  
  1169.     ROM_REGION( 0x160000, REGION_CPU2 )
  1170.     ROM_LOAD( "u151_27c.010",  0x00000, 0x20000, 0x2622dfa4 )
  1171.     ROM_LOAD( "u152_27c.020",  0x20000, 0x20000, 0xad40e4e2 )
  1172.     ROM_CONTINUE(             0x120000, 0x20000 )
  1173.     ROM_LOAD( "u153_27c.020",  0x40000, 0x20000, 0x1e3803f7 )
  1174.     ROM_CONTINUE(             0x140000, 0x20000 )
  1175.     ROM_LOAD( "u154_27c.010",  0x60000, 0x20000, 0x76d3c235 )
  1176.     ROM_LOAD( "u155_27c.010",  0x80000, 0x20000, 0xd5d866b3 )
  1177.     ROM_LOAD( "u156_27c.010",  0xa0000, 0x20000, 0x7fe71842 )
  1178.     ROM_LOAD( "u157_27c.010",  0xc0000, 0x20000, 0xa6462adc )
  1179.     ROM_LOAD( "u158_27c.010",  0xe0000, 0x20000, 0xd6ef27a3 )
  1180.  
  1181.     ROM_REGION( 0x100000, REGION_CPU3 )
  1182.     ROM_LOAD_V20_EVEN( "u3_27c.010",  0x20000, 0x20000, 0x97413818 )
  1183.     ROM_LOAD_V20_ODD ( "u6_27c.010",  0x20000, 0x20000, 0x15a89962 )
  1184.     ROM_LOAD_V20_EVEN( "u4_27c.010",  0x60000, 0x20000, 0xfa7bfa04 )
  1185.     ROM_RELOAD_V20_EVEN(              0xc0000, 0x20000 )
  1186.     ROM_LOAD_V20_ODD ( "u5_27c.010",  0x60000, 0x20000, 0x198285d4 )
  1187.     ROM_RELOAD_V20_ODD (              0xc0000, 0x20000 )
  1188.  
  1189.     ROM_REGION( 0xc0000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  1190.     ROM_LOAD( "u145_27c.010",  0x00000, 0x20000, 0x612d4bf8 )
  1191.     ROM_LOAD( "u146_27c.010",  0x20000, 0x20000, 0x77a725f6 )
  1192.     ROM_LOAD( "u147_27c.010",  0x40000, 0x20000, 0xd6aac372 )
  1193.     ROM_LOAD( "u148_27c.010",  0x60000, 0x20000, 0x5d19723e )
  1194.     ROM_LOAD( "u149_27c.010",  0x80000, 0x20000, 0x29056791 )
  1195.     ROM_LOAD( "u150_27c.010",  0xa0000, 0x20000, 0xcb73dd6a )
  1196.  
  1197.     ROM_REGION( 0x40000, REGION_USER1 ) /* X-ROM (data used by main processor) */
  1198.     ROM_LOAD( "u68_27c.010",   0x00000, 0x10000, 0x9e88efb3 )
  1199.     ROM_CONTINUE(              0x20000, 0x10000 )
  1200.     ROM_LOAD( "u69_27c.010",   0x10000, 0x10000, 0xaa39fcb3 )
  1201.     ROM_CONTINUE(              0x30000, 0x10000 )
  1202.  
  1203.     ROM_REGION( 0x40000, REGION_SOUND1 ) /* externally clocked DAC data */
  1204.     ROM_LOAD( "u8_27c.010",  0x00000, 0x20000, 0x9f16e5b6 )
  1205.     ROM_LOAD( "u9_27c.010",  0x20000, 0x20000, 0x0dc8f488 )
  1206.  
  1207.     ROM_REGION( battery_ram_size + extra_tram_size, REGION_USER2 ) /* extra RAM regions */
  1208. ROM_END
  1209.  
  1210.  
  1211.  
  1212. /*************************************
  1213.  *
  1214.  *    Driver initialization
  1215.  *
  1216.  *************************************/
  1217.  
  1218. extern void leland_rotate_memory(int cpunum);
  1219.  
  1220. static void init_ataxx(void)
  1221. {
  1222.     /* initialize the default EEPROM state */
  1223.     static const UINT16 ataxx_eeprom_data[] =
  1224.     {
  1225.         0x09,0x0101,
  1226.         0x0a,0x0104,
  1227.         0x0b,0x0401,
  1228.         0x0c,0x0101,
  1229.         0x0d,0x0004,
  1230.         0x13,0x0100,
  1231.         0x14,0x5a04,
  1232.         0xffff
  1233.     };
  1234.     init_eeprom(0x00, ataxx_eeprom_data, 0x00);
  1235.  
  1236.     leland_rotate_memory(0);
  1237.     leland_rotate_memory(1);
  1238.  
  1239.     /* set up additional input ports */
  1240.     install_port_read_handler(0, 0x00, 0x03, ataxx_trackball_r);
  1241.  
  1242.     /* optimize the sound */
  1243.     leland_i86_optimize_address(0x612);
  1244. }
  1245.  
  1246. static void init_ataxxj(void)
  1247. {
  1248.     /* initialize the default EEPROM state */
  1249.     static const UINT16 ataxxj_eeprom_data[] =
  1250.     {
  1251.         0x09,0x0101,
  1252.         0x0a,0x0104,
  1253.         0x0b,0x0001,
  1254.         0x0c,0x0101,
  1255.         0x13,0xff00,
  1256.         0x3f,0x3c0c,
  1257.         0xffff
  1258.     };
  1259.     init_eeprom(0x00, ataxxj_eeprom_data, 0x00);
  1260.  
  1261.     leland_rotate_memory(0);
  1262.     leland_rotate_memory(1);
  1263.  
  1264.     /* set up additional input ports */
  1265.     install_port_read_handler(0, 0x00, 0x03, ataxx_trackball_r);
  1266.  
  1267.     /* optimize the sound */
  1268.     leland_i86_optimize_address(0x612);
  1269. }
  1270.  
  1271. static void init_wsf(void)
  1272. {
  1273.     /* initialize the default EEPROM state */
  1274.     static const UINT16 wsf_eeprom_data[] =
  1275.     {
  1276.         0x04,0x0101,
  1277.         0x0b,0x04ff,
  1278.         0x0d,0x0500,
  1279.         0x26,0x26ac,
  1280.         0x27,0xff0a,
  1281.         0x28,0xff00,
  1282.         0xffff
  1283.     };
  1284.     init_eeprom(0x00, wsf_eeprom_data, 0x00);
  1285.  
  1286.     leland_rotate_memory(0);
  1287.     leland_rotate_memory(1);
  1288.  
  1289.     /* set up additional input ports */
  1290.     install_port_read_handler(0, 0x0d, 0x0d, input_port_3_r);
  1291.     install_port_read_handler(0, 0x0e, 0x0e, input_port_4_r);
  1292.     install_port_read_handler(0, 0x0f, 0x0f, input_port_5_r);
  1293.  
  1294.     /* optimize the sound */
  1295.     leland_i86_optimize_address(0x612);
  1296. }
  1297.  
  1298. static void init_indyheat(void)
  1299. {
  1300.     /* initialize the default EEPROM state */
  1301.     static const UINT16 indyheat_eeprom_data[] =
  1302.     {
  1303.         0x2c,0x0100,
  1304.         0x2d,0x0401,
  1305.         0x2e,0x05ff,
  1306.         0x2f,0x4b4b,
  1307.         0x30,0xfa4b,
  1308.         0x31,0xfafa,
  1309.         0xffff
  1310.     };
  1311.     init_eeprom(0x00, indyheat_eeprom_data, 0x00);
  1312.  
  1313.     leland_rotate_memory(0);
  1314.     leland_rotate_memory(1);
  1315.  
  1316.     /* set up additional input ports */
  1317.     install_port_read_handler(0, 0x00, 0x02, indyheat_wheel_r);
  1318.     install_port_read_handler(0, 0x08, 0x0b, indyheat_analog_r);
  1319.     install_port_read_handler(0, 0x0d, 0x0d, input_port_9_r);
  1320.     install_port_read_handler(0, 0x0e, 0x0e, input_port_10_r);
  1321.     install_port_read_handler(0, 0x0f, 0x0f, input_port_11_r);
  1322.  
  1323.     /* set up additional output ports */
  1324.     install_port_write_handler(0, 0x08, 0x0b, indyheat_analog_w);
  1325.  
  1326.     /* optimize the sound */
  1327.     leland_i86_optimize_address(0x613);
  1328. }
  1329.  
  1330.  
  1331.  
  1332. /*************************************
  1333.  *
  1334.  *    Game drivers
  1335.  *
  1336.  *************************************/
  1337.  
  1338. GAME( 1990, ataxx,    0,      ataxx,   ataxx,    ataxx,    ROT0,   "Leland Corp.", "Ataxx (set 1)" )
  1339. GAME( 1990, ataxxa,   ataxx,  ataxx,   ataxx,    ataxx,    ROT0,   "Leland Corp.", "Ataxx (set 2)" )
  1340. GAME( 1990, ataxxj,   ataxx,  ataxx,   ataxx,    ataxxj,   ROT0,   "Leland Corp.", "Ataxx (Japan)" )
  1341. GAME( 1990, wsf,      0,      wsf,     wsf,      wsf,      ROT0,   "Leland Corp.", "World Soccer Finals" )
  1342. GAME( 1991, indyheat, 0,      wsf,     indyheat, indyheat, ROT0,   "Leland Corp.", "Danny Sullivan's Indy Heat" )
  1343.